package com.atguigu.yygh.msm.controller;

import com.atguigu.yygh.msm.service.MsmService;
import com.atguigu.yygh.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/msm")
public class MsmController {

    @Autowired
    private MsmService msmService;

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @PostMapping(value = "/send/{phone}")
    public R code(@PathVariable String phone) {
        boolean flag = msmService.send(phone);
        if(flag){
            return R.ok();
        }else {
            return R.error().message("验证码发送失败");
        }
    }
}